package com.silverbox.waimai.dubboApi.shopper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.silverbox.core.annotation.DataSource;
import com.silverbox.core.exception.CoreException;
import com.silverbox.core.exception.CoreException.CoreExceptionCode;
import com.silverbox.waimai.dubboApi.shopper.BusinessInfoApi;
import com.silverbox.waimai.entity.SweepClose;
import com.silverbox.waimai.service.shopper.BusinessInfoService;

@Service
@DataSource(name = DataSource.DATASOURCE_B)
public class BusinessInfoApiImpl implements BusinessInfoApi{
	
	@Autowired
	private BusinessInfoService businessInfoService;
	
	@Override
	public SweepClose getSweepCloseByStoreId(Integer storeId) {
		if(storeId==null){
			throw new CoreException("shopId is null", CoreExceptionCode.EXCP_PARAM_NULL);
		}else{
			return businessInfoService.getSweepCloseByStoreId(storeId);
		}
	}

	@Override
	public int updateSweepClose(SweepClose sweepClose) {
		if(sweepClose==null){
			throw new CoreException("sweepClose is null", CoreExceptionCode.EXCP_PARAM_NULL);
		}else{
			return businessInfoService.updateSweepClose(sweepClose);
		}
	}

}
